#pragma once
#include "BinaryNode.h"
//#include "Define.h"
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <sstream>
#include <string>
#include <map>
#include <stdio.h>
#include <algorithm>

class BinaryTree {

public:	
	int mapwidth;
	int mapheight;
	int count;
	map<string, string> bTreeMap;	
	string list_id;
	int startx, endx;//map
	RECT rNode;
	BinaryNode *root;

	BinaryTree(void);
	BinaryTree(int _mapwidth, int _mapheight);
	~BinaryTree();

	void Release();
	void Release(BinaryNode *root);
	void Reset();

	void ReadBinaryTreeFormFile(int level);
	void Deserialize();
	void SaveNode(BinaryNode *iroot);
	void GetNodeInfo(string info);

	void RemoveObj(Static* obj);
	void RemoveObj(BinaryNode* root, Static* obj);	

	void RenderScreen();
	void RenderScreen(BinaryNode *root);
	void RenderObj();

	void UpdateScreen();
	void UpdateScreen(BinaryNode* root);
	

	//void GetListObjCanCollide(RECT rectObj);
	//void GetListObjCanCollide(RECT rectObj, BinaryNode *root);

	void Save();
	void Save(BinaryNode *root);
};